package 循环语句作业;

public class homework6 {

    public static void main(String[] args) {
    System.out.println("1到100之间的素数有: ");
    for (int i = 2; i <= 100; i++) {
        boolean isPrime = true;
        for (int j = 2; j * j <= i; j++) {
            if (i % j == 0) {
                isPrime = false;
                break;
            }
        }
        if (isPrime) {
            System.out.print(i + " ");
        }
    }
    System.out.println();
}
}

